﻿using System.Net;

namespace ScreenWarnning
{
    public partial class FormBrowser : Form
    {
        private string _path = "/wq/admin/itemdata/dataApply";

        public FormBrowser()
        {
            InitializeComponent();
            webView21.EnsureCoreWebView2Async();
        }

        private async void FormBrowser_Load(object sender, EventArgs e)
        {
            await webView21.EnsureCoreWebView2Async();

            foreach (Cookie cookie in GlobalContext.DataProvider.CookieCollection)
            {
                var cookieObj = webView21.CoreWebView2.CookieManager.CreateCookie(cookie.Name, cookie.Value, cookie.Domain, cookie.Path);
                webView21.CoreWebView2.CookieManager.AddOrUpdateCookie(cookieObj);
            }

            webView21.CoreWebView2.Navigate(GlobalContext.ServerHost + _path);
        }
    }
}
